﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CustomerManagerSearch.aspx.cs"
    Inherits="ZLDC.Estate.CM.CustomerManagerSearch" %>

<%@ Register Src="../UserControl/Estate_Autocomplete.ascx" TagName="Estate_Autocomplete"
    TagPrefix="uc1" %>
<%@ Register src="../UserControl/Dept_Tree.ascx" tagname="Dept_Tree" tagprefix="uc2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>客源查询条件</title>
    <link href="../css/main.css" rel="stylesheet" type="text/css" />
    <link href="../js/jquery/style/jquery.simple.tree.css" rel="stylesheet" type="text/css" />

    <script src="../js/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>

    <script src="../js/My97DatePicker/WdatePicker.js" type="text/javascript"></script>

</head>
<body>
    <form id="form1" runat="server">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td bgcolor="#FFFFFF" colspan="8">
                <b>基本查询</b>
            </td>
        </tr>
        <tr>
            <td>
                <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
                    <tr>
                        <td width="10%" height="25" align="right" bgcolor="#F7F7F7">
                            客户:
                        </td>
                        <td width="20%" bgcolor="#FFFFFF" >
                            <input id="iCustomer" name="iCustomer" type="text" style="width: 80px;" />
                        </td>
                        <td width="12%" height="25" align="right" bgcolor="#F7F7F7">
                            电话:
                        </td>
                        <td width="25%" bgcolor="#FFFFFF" >
                            <input id="iCustomerTel" name="iCustomerTel" type="text" style="width: 100px;" />
                        </td>
                        <td width="10%" height="25" align="right" bgcolor="#F7F7F7">
                            户型:
                        </td>
                        <td width="25%" bgcolor="#FFFFFF" >
                            <select id="Select1" name="sRoom" runat="server">
                                <option value="0">全部</option>
                                <option value="1">1</option>
                                <option value="2">2</option>
                                <option value="3">3</option>
                                <option value="4">4</option>
                                <option value="5">5</option>
                                <option value="6">6</option>
                                <option value="7">7</option>
                                <option value="8">8</option>
                                <option value="9">9</option>
                            </select>～
                            <select id="Select2" name="sHall" runat="server">
                                <option value="0">全部</option>
                                <option value="1">1</option>
                                <option value="2">2</option>
                                <option value="3">3</option>
                                <option value="4">4</option>
                                <option value="5">5</option>
                                <option value="6">6</option>
                                <option value="7">7</option>
                                <option value="8">8</option>
                                <option value="9">9</option>
                            </select>房
                        </td>
                    </tr>
                    <tr>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            交易:
                        </td>
                        <td bgcolor="#FFFFFF" >
                            <select id="sTradeType" name="sTradeType" style="width: 80px;" onchange="sTradeType_OnChange('sTradeType')">
                                <option value="">全部</option>
                                <option value="求购">求购</option>
                                <option value="求租">求租</option>
                            </select>
                        </td>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            楼层:
                        </td>
                        <td bgcolor="#FFFFFF" >
                            <input id="iFloor1" name="iFloor1" type="text" style="width: 44px;" onkeyup="LexunJS.checkNum(this)" />
                            ~<input id="iFloor2" name="iFloor2" type="text" style="width: 44px;" onkeyup="LexunJS.checkNum(this)" />
                        </td>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            价格:
                        </td>
                        <td bgcolor="#FFFFFF" >
                            <input id="iPrice1" name="iPrice1" type="text" style="width: 40px;" onkeyup="LexunJS.checkNum(this)" />
                            ~
                            <input id="iPrice2" name="iPrice2" type="text" style="width: 40px;" onkeyup="LexunJS.checkNum(this)" /><font color="red"><span id="spanTradeTypeUnit">万元</span></font>
                        </td>
                    </tr>
                    <tr>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            公/私:
                        </td>
                        <td bgcolor="#FFFFFF" >
                            <select id="sIsSelf" name="sIsSelf" runat="server" style="width: 80px;">
                                <option value="-1">全部</option>
                                <option value="0">私客</option>
                                <option value="1">公客</option>
                            </select>
                        </td>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            朝向:
                        </td>
                        <td bgcolor="#FFFFFF" >
                            <select id="sDirect" name="sDirect" runat="server" style="width: 80px;">
                            </select>
                        </td>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            面积:
                        </td>
                        <td bgcolor="#FFFFFF" >
                            <input id="iAcreage1" name="iAcreage1" type="text" style="width: 40px;" onkeyup="LexunJS.checkNum(this)" />
                            ~
                            <input id="iAcreage2" name="iAcreage2" type="text" style="width: 40px;" onkeyup="LexunJS.checkNum(this)" /><font
                                color="red">m2</font>
                        </td>
                    </tr>
                    <tr>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            来源:
                        </td>
                        <td bgcolor="#FFFFFF"  >
                            <select id="infoFrom" runat="server" style="width: 120px;"  name="infoFrom">
                            <option></option>
                            </select>
                        </td>
                        
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            看房次数:
                        </td>
                        <td bgcolor="#FFFFFF"  >
                             <input id="lookCount1" name="lookCount1" type="text" style="width: 44px;" onkeyup="LexunJS.checkNum(this)" />
                            ~<input id="lookCount2" name="lookCount2" type="text" style="width: 44px;" onkeyup="LexunJS.checkNum(this)" />
                       
                        </td>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                           备注(关键字):
                        </td>
                        <td bgcolor="#FFFFFF"  >
                             <input id="remark" name="remark" type="text" style="width: 140px;" title="备注关键字搜索" />
                        </td>
                        
                        
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td bgcolor="#FFFFFF" colspan="8">
                <b>高级查询</b>
            </td>
        </tr>
        <tr>
            <td>
                <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
                    <tr>
                        <td width="10%" height="25" align="right" bgcolor="#F7F7F7">
                            客源编号:
                        </td>
                        <td width="20%" bgcolor="#FFFFFF" >
                            <input id="iID" name="iID" type="text" style="width: 80px;" onkeyup="LexunJS.checkNum(this)" />
                        </td>
                        <td width="12%" height="25" align="right" bgcolor="#F7F7F7">
                            用途:
                        </td>
                        <td width="25%" bgcolor="#FFFFFF" >
                            <select id="sUsage" name="sUsage" runat="server" style="width:80px;">
                            </select>
                        </td>
                        <td width="10%" height="25" align="right" bgcolor="#F7F7F7">
                            状态:
                        </td>
                        <td width="25%" bgcolor="#FFFFFF" >
                            <select id="sStatus" name="sStatus" runat="server" style="width:80px;">
                                <option value="-1">全部</option>
                                <option value="0">当前</option>
                                <option value="1">资料</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            等级:
                        </td>
                        <td bgcolor="#FFFFFF" >
                            <select id="sCustomerClass" name="sCustomerClass" runat="server" style="width: 80px;">
                            </select>
                        </td>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            片区:
                        </td>
                        <td bgcolor="#F7F7F7" >
                            
                            <select id="sCity3" name="sCity3" runat="server" style="width: 80px;">
                                <option value="0">全部</option>
                            </select>
                        </td>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            委托日期:
                        </td>
                        <td bgcolor="#FFFFFF" >
                            <input id="iStartDay" name="iStartDay" onclick="WdatePicker()" style="width: 55px;" />
                            ~
                            <input id="iEndDay" name="iEndDay" onclick="WdatePicker()" style="width: 55px;" />
                        </td>
                    </tr>
                    <tr>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            装修:
                        </td>
                        <td bgcolor="#FFFFFF" >
                            <select id="sFitment" name="sFitment" runat="server" style="width: 80px;">
                            </select>
                        </td>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            样式:
                        </td>
                        <td bgcolor="#FFFFFF" >
                            <select id="sHouseStyle" name="sHouseStyle" runat="server" style="width: 80px;">
                            </select>
                        </td>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            类型:
                        </td>
                        <td bgcolor="#FFFFFF" >
                            <select id="sType" name="sType" runat="server" style="width: 80px;">
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            城区:
                        </td>
                        <td bgcolor="#FFFFFF" >
                            <select id="sCity2" name="sCity2" runat="server" style="width: 80px;" onchange="return loadCity('sCity2', 'sCity3')">
                            </select>
                        </td>
                        
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            所属人部门:
                        </td>
                        <td bgcolor="#FFFFFF" >
                            
                            <uc2:Dept_Tree ID="Dept_Tree1" runat="server" />
                            
                        </td>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            所属人:
                        </td>
                        <td bgcolor="#FFFFFF" >
                            <input id="usubclass" title='拼音首字母提示,格式:姓名[工号,部门]' style="width: 80px" name="umainclass"
                                onblur="selDU()" />
                            <input id="utxtsub" name="utxtsub" runat="server" style="display: none;" />
                        </td>
                        
                    </tr>
                    <tr>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            意向楼盘:
                        </td>
                        <td bgcolor="#FFFFFF" >
                            <uc1:Estate_Autocomplete ID="Estate_Autocomplete1" runat="server" />
                        </td>
                        <td width="10%" height="25" align="right" bgcolor="#F7F7F7">
                            是否转介:
                        </td>
                        <td width="25%" bgcolor="#FFFFFF" >
                            <input id="cbIsChange" name="cbIsChange" type="checkbox" />
                        </td>
                         <td width="10%" height="25" align="right" bgcolor="#F7F7F7">
                            是否包含转出客:
                        </td>
                        <td width="25%" bgcolor="#FFFFFF" >
                            <input id="cbIsChangeOut" name="cbIsChangeOut" type="checkbox" />
                        </td>
                   </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td align="center" colspan="6">
                <br />
                <input id="btnSearch" class="button_bak" type="button" value="查询" onclick="return search()" />
                &nbsp;
                <input id="btnReset" class="button_bak" type="button" value="重置" onclick="return reset()" />
            </td>
        </tr>
    </table>
    </form>
</body>

<script src="../js/jquery.autocomplete/jquery.autocomplete.min.js" type="text/javascript"></script>

<script src="../js/jquery/jquery.simple.tree.js" type="text/javascript"></script>

<script src="../js/cm_customerchange.js" type="text/javascript"></script>

<script src="../js/LexunJS.js" type="text/javascript"></script>

<script type="text/javascript" language="javascript">
    // 条件查询
    function search() {
        var customerName = $("#iCustomer").val();                   // 客户名称
        var customerTel = $("#iCustomerTel").val();                 // 客户电话
        var room = LexunJS.GetSelectValue("Select1");                               // 房
        var hall = LexunJS.GetSelectValue("Select2");                               // 厅
       
        var price1 = $("#iPrice1").val();                           // 租售价
        var price2 = $("#iPrice2").val();                           // 租售价
        var customerClass = $("#sCustomerClass").val();             // 客户等级 如:普通\实在...
        var tradeType = $("#sTradeType").val();                     // 交易类型 如:求购、求租
        var dname = LexunJS.GetSelectText("sCity2");                // 城区名称
        var aname = LexunJS.GetSelectText("sCity3");                // 片区名称
        var acreage1 = $("#iAcreage1").val();                       // 面积1
        var acreage2 = $("#iAcreage2").val();                       // 面积2

        // 高级查询
        var id = $("#iID").val();                                   // 序号            
        var fitment = LexunJS.GetSelectValue("sFitment");           // 装修
        var floor1 = $("#iFloor1").val();                           // 楼层
        var floor2 = $("#iFloor2").val();                           // 楼层
        var addDate1 = $("#iStartDay").val();                       // 委托日期
        var addDate2 = $("#iEndDay").val();                         // 委托日期
        var usage = $("#sUsage").val();                             // 用途
        var houseStyle = LexunJS.GetSelectValue("sHouseStyle");     // 样式
        var direct = LexunJS.GetSelectValue("sDirect");             // 朝向
        var type = LexunJS.GetSelectValue("sType");                 // 类型
        var status = LexunJS.GetSelectValue("sStatus");             // 状态        
        var isSelf = LexunJS.GetSelectValue("sIsSelf");             // 性质 -1全部 0私客 1公客
        var isChange = 0;                                           // 0非转介客 1转介客
        if ($("#cbIsChange").get(0).checked)
            isChange = 1;
        var ischangeout = 0;                                           // 1是包含转出客,0不包含转出客
        if ($("#cbIsChangeOut").get(0).checked)
            ischangeout = 1;                    

        var estates = $("#hEstateName").val();                      // 意向楼盘名称
        if (estates == "楼盘名称、拼音均可")
            estates = "";
        var ownerDept =  $("#utxdeptid").val();                    // 所属人部门ID
        var owner = $("#usubclass").val();                          // 所属人

        var infoFrom = LexunJS.GetSelectValue("infoFrom");         //来源

        var lookCount1 = $("#lookCount1").val();                    //看房次数

        var lookCount2 = $("#lookCount2").val();

        var remark = $("#remark").val();

        var url = '../CM/CustomerManager.aspx?customerName=' + escape(customerName) + '&customertel=' + escape(customerTel) + '&room=' + room
                    + '&hall=' + hall + '&price1=' + price1 + '&price2=' + price2 + '&customerClass=' + escape(customerClass) + '&tradeType=' + escape(tradeType)
                    + '&dname=' + escape(dname) + '&aname=' + escape(aname) + '&acreage1=' + acreage1 + '&acreage2=' + acreage2
                    + '&id=' + id + '&fitment=' + escape(fitment) + '&floor1=' + floor1 + '&floor2=' + floor2 + '&addDate1=' + addDate1 + '&addDate2=' + addDate2 + '&usage=' + escape(usage)
                    + '&houseStyle=' + escape(houseStyle) + '&direct=' + escape(direct) + '&type=' + escape(type) + '&status=' + status + '&isSelf=' + isSelf + '&isChange=' + isChange + "&estates=" + escape(estates)
                    + '&ownerDept=' + escape(ownerDept) + '&owner=' + escape(owner) + '&infoFrom=' + escape(infoFrom) + '&ischangeout=' + ischangeout + '&lookCount1=' + lookCount1 + '&lookCount2=' + lookCount2 + "&remark=" + escape(remark);

        self.parent.closeTab('客源列表');
        self.parent.addTab('客源列表', url, 'icon-nav');
    }

    // 级联加载列表
    function loadCity(sCity1, sCity2) {
        var parentid = document.getElementById(sCity1).value;
        if (parentid <= 0)
            return false;

        $.ajax({
            type: 'POST',
            url: '../Handler/HandlerIndex.ashx',
            data: 'act=area_list&parentid=' + parentid,
            timeout: '10000',
            error: function() {
                alert("修改失败！");
            }, success: function(json) {
                loadCity2CallBack(json, sCity2);
            }
        });
    }

    // 加载城市列表回调
    function loadCity2CallBack(response, sCity2) {
        var json = eval("(" + response + ")");
        var record = json.record;

        $("#" + sCity2).html("");
        var obj = document.getElementById(sCity2);
        LexunJS.selectAddOption(obj, "全部", 0);

        if (record == null || record.length == 0)
            return;

        var recordLength = record.length;
        for (var i = 0; i < recordLength; i++) {
            var sName = record[i].name;
            var sValue = record[i].id;

            LexunJS.selectAddOption(obj, sName, sValue);
        }
    }

    // 切换交易类型
    function sTradeType_OnChange(selectName) {
        var sValue = LexunJS.GetSelectValue(selectName);
        if (sValue == "求租")
            $("#spanTradeTypeUnit").text("元/月");
        else
            $("#spanTradeTypeUnit").text("万元");
    }

    // 重置
    function reset() {
        window.location.href = "";
    }
    
</script>

</html>
